package com.jason.campusinn.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

import com.yuandian.wanna.utils.DisplayUtil;

/**
 * Created by yuandian on 2015/5/19.
 */
public class SelectedEnlargeTextView extends TextView{
    public SelectedEnlargeTextView(Context context) {
        super(context);
    }

    public SelectedEnlargeTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public SelectedEnlargeTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public SelectedEnlargeTextView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        super(context, attrs, defStyleAttr, defStyleRes);
    }

    @Override
    public void setSelected(boolean selected) {
        super.setSelected(selected);
        String text = getText().toString();
        float size = getTextSize();

        if (selected && text != null){
            setText(DisplayUtil.changeTextSize(text, (int) (size + 5),false,0,text.length()));
        } else {
            setText(DisplayUtil.changeTextSize(text, (int) size,false,0,text.length()));
        }
    }
}
